package acm.test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class 货币系统 {
    static int[] a;
    static List<Integer> b; //不能被其他货币表示的面值

    public static void main(String[] args) {
        Reader sc = new Reader();
        int count = sc.nextInt();
        for (int i = 0; i < count; i++) {
            int n = sc.nextInt();
            a = new int[n];
            for (int j = 0; j < n; j++) {
                a[j] = sc.nextInt();
            }
            b = new ArrayList<>();
            Arrays.sort(a);
            b.add(a[0]);
            for (int j = 1; j < n; j++) {
                if (!fun(b.size()-1, a[j])) {
                    b.add(a[j]);
                }
            }
            System.out.println(b.size());
        }
    }

    /**
     * 暴力解：
     * 金额money，能不能被b中0-i的货币表示
     */
    public static boolean fun(int i, int money) {
        if (i < 0) {
            return false;
        }
        Integer curr = b.get(i);
        if (money % curr == 0) {
            return true;
        }
        int len = money / curr;
        for (int j = 0; j <= len; j++) {   //取j个当前面额+len-j个其他面值是否能表示出来
            if (fun(i - 1, money - j * curr)) {
                return true;
            }
        }
        return false;
    }

    static
    class Reader {
        private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer tokenizer = new StringTokenizer("");

        private String innerNextLine() {
            try {
                return reader.readLine();
            } catch (IOException ex) {
                return null;
            }
        }

        public boolean hasNext() {
            while (!tokenizer.hasMoreTokens()) {    //内存中没有
                String nextLine = innerNextLine();
                if (nextLine == null) {     //且没有下一行
                    return false;
                }
                tokenizer = new StringTokenizer(nextLine);  //读入一行
            }
            return true;
        }

        public String nextLine() {
            tokenizer = new StringTokenizer("");    //清空内存中的字符
            return innerNextLine();
        }
        public void clear(){
            tokenizer = new StringTokenizer("");
        }

        public String next() {
            hasNext();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }

}
